<?xml version="1.0"?>
<!--EXTERNAL_PROPERTIES: output.dir;AssemblyName;debug;keyfile-->
<project name="general compilation">
  <target name="clean" >
    <delete dir="${output.dir}"/>
  </target>

  <target name="init" depends="clean" >
    <mkdir dir="${output.dir}" />
    <mkdir dir="${output.dir}/bin" />
  </target>

  <target name="general.compile.assembly" description="compiles a satellite assembly">
    <echo message="Building ${AssemblyName} to ${output.dir}/bin" />
    <if test="${not (KeyFile=='')}">
      <echo message="signed build" />
      <csc target="library" output="${output.dir}/bin/${AssemblyName}.dll" debug="${debug}" keyfile="${KeyFile}">
        <sources>
          <include name="${AssemblyName}/**/*.cs" />
        </sources>
        <references refid="assembly.resources" />
      </csc>
    </if>
    <if test="${KeyFile==''}">
      <echo message="non-signed build" />
      <csc target="library" output="${output.dir}/bin/${AssemblyName}.dll" debug="${debug}">
        <sources>
          <include name="${AssemblyName}/**/*.cs" />
        </sources>
        <references refid="assembly.resources" />
      </csc>
    </if>
    <property name="KeyFile" value="" />
  </target>

  <target name="prepare.web" >
    <mkdir dir="${output.dir}\${website.name}" />

    <copy todir="${output.dir}" flatten="false">
      <fileset>
        <include name="${website.name}\**\*.*" />
        <exclude name="${website.name}\config" />
        <!-- this are where we put environment-specific config files -->
        <exclude name="${website.name}\bin\*.*" />
        <exclude name="${website.name}\web.config" />
      </fileset>
    </copy>
    <copy todir="${output.dir}\${website.name}\bin" flatten="true">
      <fileset>
        <include name="${output.dir}\bin\*.*" />
      </fileset>
    </copy>
    <copy todir="${output.dir}\${website.name}\bin" flatten="true">
      <fileset refid="website.resources" />
    </copy>
  </target>

  <target name="general.compile.website" description="compiles a website" depends="prepare.web">
    <mkdir dir="${output.dir}\Deploy\${website.name}" />
    <exec program="aspnet_compiler.exe"
          basedir="C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727"
          workingdir="${output.dir}"
          commandline="-u -v /${website.name} -p ${output.dir}\${website.name} ${output.dir}\Deploy\${website.name}"  />
  </target>

  <target name="general.compile.website.copyconfig" description="Copies an XML file to the website's web.config, replacing tokens as specific in fileset">
    <copy file="${template.sourcefilename}" tofile="${output.dir}\Deploy\${website.name}\web.config">
      <filterchain refid="config.settings" />
    </copy>
  </target>

  <!-- web deployment projects -->
  <target name="prepare.wdp" >
    <echo message="*******************************" />
    <echo message="***COMPILING Web Deployment Project ${website.name}" />
    <echo message="*******************************" />
  </target>

  <target name="general.compile.wdp" description="compiles a web deployment project" depends="prepare.wdp">
    <exec program="msbuild.exe"
			  basedir="C:\WINDOWS\Microsoft.NET\Framework\v3.5"
			  workingdir="${base.dir}"
			  commandline="${webdeploymentproject.path} /p:AssemblyLabel=${assembly.label}"  />
  </target>
</project>